package com.hxzy.shop.feign.commodity;

import com.github.pagehelper.PageInfo;
import com.hxzy.shop.common.dto.commodity.req.ClassificationsReq;
import com.hxzy.shop.common.dto.commodity.resp.ClassifiedManagementResp;
import com.hxzy.shop.fallback.commodity.CommodityFallback;
import com.hxzy.shop.vo.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import com.github.pagehelper.PageInfo;
import com.hxzy.shop.dto.commodity.DrugExportDto;
import com.hxzy.shop.dto.commodity.ExportDrugDto;
import com.hxzy.shop.dto.commodity.TempzyDto;
import com.hxzy.shop.dto.commodity.req.*;
import com.hxzy.shop.dto.commodity.resp.*;
import com.hxzy.shop.dto.coupon.req.CouponListReq;
import com.hxzy.shop.dto.coupon.resp.CouponListResp;
import com.hxzy.shop.dto.marketing.dto.req.ActivityBaseReq;
import com.hxzy.shop.entity.*;
import com.hxzy.shop.fallback.commodity.CommodityFallback;
import com.hxzy.shop.vo.Result;
import com.hxzy.shop.vo.ResultCode;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;

import java.util.List;

/**
 * 功能描述 :商品远程服务
 *
 * @author tonneyyy
 */
@FeignClient(value = "commondity", fallback = CommodityFallback.class)
public interface CommodityFeign {

    /**
     * 商品分类
     * @param classifiedPage
     * @return
     */
    @GetMapping(value = "/classification/getClassifiedPage")
    Result<PageInfo<ClassifiedManagementResp>> getClassifiedPage(@SpringQueryMap ClassificationsReq classifiedPage);


    /**
     * @author qy
     * @date 2021/8/10
     * @description 获得分类列表
     **/
    @PostMapping(value = "/classification/getClassifiedList")
    Result<List<ClassifiedManagementResp>> getClassifiedList();


/******************************* 处方药管理 *********************************/
    /**
     * @author qy
     * @date 2021/8/10
     * @description 检测是否开通处方药售卖类目
     **/
    @PostMapping("/prescription/checkOpenPre")
    Result<Boolean> checkOpenPre();

    /**
     * @author qy
     * @date 2021/8/10
     * @description 分页查询处方药品
     **/
    @PostMapping("/prescription/getDrugPage")
    Result<PageInfo<DrugResp>> getPreDrugPage(@RequestBody DrugPageReq drugPageReq);

    /**
     * @author qy
     * @date 2021/8/10
     * @description 新建查询处方药列表(drugIdList为处方药的prescriptionId数组)
     **/
    @PostMapping("/prescription/getPrescriptionList")
    Result<PageInfo<Prescriptiondrug>> getPrescriptionList(@RequestBody DrugPageReq drugPageReq);

    /**
     * @author qy
     * @date 2021/8/10
     * @description 添加处方药
     **/
    @PostMapping("/prescription/addPrescription")
    Result<Boolean> addPrescription(@RequestBody List<Long> idList);

    /**
     * @author qy
     * @date 2021/8/10
     * @description 查看处方药详情
     **/
    @PostMapping("/prescription/showPrescription")
    Result<DrugResp> showPrescription(@RequestBody DrugInfoReq drugInfoReq);

    /**
     * @author qy
     * @date 2021/8/10
     * @description 编辑处方药
     **/
    @PostMapping("/prescription/editPrescription")
    Result<Boolean> editPrescription(@RequestBody @Validated AddDrugReq addDrugReq);

    /**
     * @author qy
     * @date 2021/8/10
     * @description 删除处方药
     **/
    @PostMapping("/prescription/deletePrescription")
    Result<Boolean> deletePrescription(@RequestBody DrugInfoReq drugInfoReq);

    /**
     * @author qy
     * @date 2021/8/10
     * @description 修改处方药状态
     **/
    @PostMapping("/prescription/editState")
    Result<Boolean> editState(@RequestBody DrugUpdateReq state);


    /***************************** 处方单管理 **************************/
    /**
     * @author qy
     * @date 2021/8/10
     * @description 查询处方单剩余数量
     **/
    @PostMapping("/buyPre/preUseInfo")
    Result<MerchantPlugs> getPreInfo(@RequestBody PageRequst pageRequst);

    /**
     * @author qy
     * @date 2021/8/10
     * @description 删除药品
     **/
    @PostMapping(value = "/drug/deleteDrug")
    Result<Boolean> deleteDrug(@RequestBody List<Long> idS);

    /***************************** 处方单管理 **************************/
    /**
     * @author qy
     * @date 2021/8/11
     * @description 加载插件信息
     **/
    @PostMapping("/buyPre/loadPlugInfo")
    Result<SysPlugs> loadPlugInfo(@RequestBody PageRequst pageRequst);

    /**
     * @author qy
     * @date 2021/8/10
     * @description 获取商户充值列表
     **/
    @PostMapping("/buyPre/getRechargePage")
    Result<PageInfo<MerchantPlugspaylog>> getRechargePage(@RequestBody PageRequst pageRequst);


    /**
     * @author qy
     * @date 2021/8/10
     * @description 充值
     **/
    @PostMapping("/buyPre/recharge")
    Result<RechargeResp> recharge(@RequestBody RechargeReq rechargeReq);

/**************************处方审核配置*****************************/
    /**  获取处方配置  **/
    @PostMapping("/prescriptionReviewSettings/getPrescriptionReviewSettings")
    Result<PrescriptionReviewSettings> getPrescriptionReviewSettings();
    /**  修改处方配置  **/
    @PostMapping("/prescriptionReviewSettings/editPrescriptionReviewSettings")
    Result<Boolean> editPrescriptionReviewSettings(EditPrescriptionReviewSettingsReq req);



    @PostMapping("/drug/getHaggleDrugList")
    Result<PageInfo<DrugActivityResp>> getActivityHaggleDrugList(@RequestBody ActivityBaseReq req);

     /****************** 药品管理 *****************/
    /**
     * @author qy
     * @date 2021/8/10
     * @description 获得药品分页
     **/
    @PostMapping(value = "/drug/getDrugPage")
    Result<PageInfo<Drug>> getDrugPage(@RequestBody DrugPageReq drugPageReq);
    /**
     * @author qy
     * @date 2021/8/10
     * @description 添加商品or修改
     **/
    @PostMapping(value = "/drug/addDrug")
    Result<Boolean> addDrug(@RequestBody AddDrugReq addDrugReq);
    /**
     *
     * 新  根据分类查询药品
     * */
    @ApiOperation("根据分类获得药品")
    @PostMapping("/drug/getDrugPageByClassification")
    Result<PageInfo<Drug>> getDrugPageByClassification(ClassificationDrugPageReq req);

    /**分类：新*/

    @PostMapping("/classification/getClassifiedManagementList")
    Result<List<ClassifiedManagementResp>> getClassifiedManagement();

    @PostMapping("/drug/marketing/list")
    public Result<PageInfo<MarketingDrugListResp>> findPageDrug(@RequestBody DrugPageReq drugPageReq);
     /**
     * @author qy
     * @date 2021/8/10
     * @description 更新状态
     **/
    @PostMapping(value = "/drug/updateState")
    Result<Boolean> updateState(@RequestBody DrugUpdateReq state);
    /**
     * @author qy
     * @date 2021/8/10
     * @description 更新状态
     **/
    @PostMapping(value = "/classification/updateState")
    Result<Boolean> updateState(@RequestBody StateUpdateRep state);
    /**
     * @author qy
     * @date 2021/8/10
     * @description 获得药品详细
     **/
    @PostMapping(value = "/drug/getOneDrug")
    Result<DrugResp> getOneDrug(@RequestBody DrugInfoReq req);
    /**
     * @author qy
     * @date 2021/8/10
     * @description 添加分类
     **/
    @PostMapping(value = "/classification/addClassified")
    Result<Boolean> addClassified(@RequestBody @Valid AddClassifiedReq addClassifiedReq);

    /**
     * @author qy
     * @date 2021/8/10
     * @description 根据id获得分类详细信息
     **/
    @PostMapping(value = "/classification/getClassified/{id}")
    Result<ClassifiedManagementResp> getClassified(@PathVariable("id") Long id);
    /**
     * @author qy
     * @date 2021/8/10
     * @description 更新分类
     **/
    @PostMapping(value = "/classification/updateClassified")
    Result<Boolean> updateClassified(@RequestBody AddClassifiedReq addClassifiedReq);

    /**分类：新*/

    @ApiOperation("新增分类")
    @PostMapping("/classification/addNewClassified")
    public Result<Object> addNewClassified(@RequestBody AddNewClassifiedReq req);
    @ApiOperation("编辑分类")
    @PostMapping("/classification/editClassified")
    public Result<Object> editClassified(@RequestBody EditClassifiedReq req);

    @ApiOperation("删除分类")
    @PostMapping("/classification/deleteClassifiedById")
    public Result<Object> deleteClassifiedById(@RequestBody ClassifiedIdReq req);

    @ApiOperation("调整分类排序")
    @PostMapping("/classification/changeClassificationSort")
    public Result<Object> changeClassificationSort(ClassificationSortReq req);

    /**
     * @author qy
     * @date 2021/8/10
     * @description 根据id删除指定的分类
     **/
    @PostMapping(value = "/classification/deleteClassified/{id}")
    Result<Boolean> deleteClassified(@PathVariable("id") Long id);
    @ApiOperation("批量上下架")
    @PostMapping("/drug/updateBatchState")
    public Boolean updateBatchState(@RequestBody EditClassifyDto dto);
    @ApiOperation("批量修改分类")
    @PostMapping("/drug/updateClassify")
    public Result<Boolean> updateClassify(@RequestBody EditClassifyDto dto);
    /**
     * 批量修改药品信息
     */
    @ApiOperation("批量修改药品信息")
    @PostMapping(value = "/drug/batchEditDrugDetail",consumes =  MediaType.MULTIPART_FORM_DATA_VALUE)
    Result<ImportDrugResp> batchEditDrugDetail(MultipartFile file);
}
